package com.easy.controller;

import com.easy.util.InnerCaptchaUtil;
import com.easy.util.Result;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/captcha")
@CrossOrigin
public class CaptchaController {

    @GetMapping("/base")
    public Result getBase64() {
        return Result.success(InnerCaptchaUtil.getCaptcha());
    }

    @GetMapping("/verify")
    public Result verifyCode(@RequestParam("key") String key,@RequestParam("captcha") String code) {
        return Result.success(InnerCaptchaUtil.verifyCaptcha(key, code));
    }
}
